#ifndef __MUSIC_H__
#define __MUSIC_H__

#include <iostream>
#include <stdlib.h>
#include <string>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/types.h>

class Music
{
    Music()
    {
        main_music_path = "/res/menu_bgm.mp3";
        game_music_path = "/res/game_bgm.mp3";
    }

public:
    // 创建和删除实例
    static Music *instance();
    static void delInstance();

    void playMainMusic(); // 播放主菜单音乐
    void playGameMusic(); // 播放游戏音乐
    void stopMusic();     // 停止播放音乐

private:
    static Music *m_instance; /* 单例实例对象空间指针 */
    std::string main_music_path;
    std::string game_music_path;
    pid_t music_pid = 0;
};

#endif
